﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Content;
using MethodWorx.CMS.Services;
using MethodWorx.Core.DomainModel;
using System.ComponentModel.DataAnnotations;
using MethodWorx.CMS.Membership;

namespace MethodWorx.CMS.Requests
{
    public class CreatePageRequest
    {
        public CreatePageRequest(User user)
        {
            this.User = user;
        }

        public CreatePageRequest(Page page, User user)
        {
            this.ParentPage = page;
            this.User = user;
        }

        private string pageName;

        public Page ParentPage { get; private set; }
        public PageTemplate ExistingPageTemplate { get; set; }
        public User User { get; set; }
        public string PageName 
        {
            get { return this.pageName ?? (this.ExistingPageTemplate != null ? this.ExistingPageTemplate.Name : this.NewTemplateName); }
            set { this.pageName = value; }
        }
        public string NewTemplateName { get; set; }
        public int? MinimumRequired { get; set; }
        public int? MaximumAllowed { get; set; }


        public PageTemplate ParentTemplate { get; set; }
    }
}
